

#import "ShopcatListViewController.h"

#import "HAODEsingleton.h"
#import "UIViewExt.h"
#import "HttpRequest.h"
#import "JSONKit.h"
#import "addhuiyuanViewController.h"
#import "shopcatCell.h"
#import "RDVTabBarController.h"
#import "MJRefresh.h"
#import "UIButton+WebCache.h"
#import "huiyuanDetailsViewController.h"
#import "GetProductListViewController.h"
#import "TheLoginViewController.h"
#import "shouyingViewController.h"
@interface ShopcatListViewController ()<MBProgressHUDDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,UISearchBarDelegate>
@property (strong, nonatomic) NSString *areaValue;
@property (strong, nonatomic) NSString*cityValue;


@end

@implementation ShopcatListViewController

{
    UISearchBar *search;
    HAODEsingleton* commdity;
    MJRefreshHeaderView* _header;
    MJRefreshFooterView* _footer;
    NSMutableArray*dealPrice;
    NSMutableArray*headImage;
    NSMutableArray*itemId;
    NSMutableArray*itemName;
    NSMutableArray*quantity;
    NSMutableArray*quantitys;
    NSMutableArray*salePrice;
    NSMutableArray*specId;
    NSMutableArray* specName;
    NSMutableArray* specPrice;
    NSMutableArray* shopCartIds;
    NSMutableArray* xuanzhongshopCartIds;
    NSMutableArray*isSelect;
    NSString *result;
    int pageNumber;
    MBProgressHUD *progressHud;
    UIView* backview1;
    UIScrollView*myscrollView;
    NSString* sous;
    int pageNumber1;
    int pageNumber2;
    NSString*meiyousuos;
    UIView*view3;
    UIView*myToolBar1;
    UIButton* sxBtn;
    UIButton*jiazai;
    float lastContentOffset;
    UIButton*hejibuyBtn1;
    UIButton*kong;
    UIButton*kong1;
    UIButton*buyBtn2;
    UIButton*xuanze;
    BOOL saveAccount;
    BOOL saveAccount1;
    UIButton*xiugaiview;
    UILabel*shu;
    UITextField*jiageTextFied;
    NSString*shopCartId;
    UIView*myToolBar;
    UIView*toumingtu;
}
@synthesize alt = alt;

-(void)BackAction:(UIButton *)sender{

   [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
// [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    self.navigationController.delegate = nil;
    
}
-(void)viewWillAppear:(BOOL)animated{
   
    
    
    [super viewWillAppear:animated];
    
    [[self rdv_tabBarController] setTabBarHidden:YES];
    
    self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    
    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.textAlignment=NSTextAlignmentLeft;
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    self.navigationController.delegate = self;
    
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    self.title=@"购物车";
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     [UIColor blackColor],
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];

    self.navigationController.navigationBarHidden = NO;
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage =[[UIImage alloc] init];
    
  

}


- (void)viewDidLoad
{
    
    [super viewDidLoad];
    
    [self addFooter];
    _table.delegate=self;
    _table.dataSource=self;
    [self.view addSubview:_table];
    _table.separatorStyle=UITableViewCellSeparatorStyleNone;
    
    commdity=[HAODEsingleton shared];

    sxBtn = [[UIButton alloc] initWithFrame:CGRectMake(30, 0.0,  60/2, 60/2)];
    [sxBtn setImage:[UIImage imageNamed:@"tianjia"] forState:UIControlStateNormal];
    [sxBtn addTarget:self action:@selector(addProduct:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* myBtnBtn = [[UIBarButtonItem alloc] initWithCustomView:sxBtn];
    self.navigationItem.rightBarButtonItem = myBtnBtn;
    [self add];
}

-(void)addProduct:(UIButton*)sender{
    commdity.optionName=@"ProductType";
    commdity.how=@"Detail";
    GetProductListViewController *detailViewController = [[GetProductListViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
}


-(void)add{
   
     [dealPrice removeAllObjects];
     [itemId removeAllObjects];
     [itemName removeAllObjects];
     [quantity removeAllObjects];
     [salePrice removeAllObjects];
     [specId removeAllObjects];
    
     [quantitys removeAllObjects];
     [headImage removeAllObjects];
    [specName removeAllObjects];
    [specPrice removeAllObjects];
    [shopCartIds removeAllObjects];
    [isSelect removeAllObjects];
    [xuanzhongshopCartIds removeAllObjects];

    headImage= [[NSMutableArray alloc] init];
    itemId= [[NSMutableArray alloc] init];
    itemName= [[NSMutableArray alloc] init];
    quantity= [[NSMutableArray alloc] init];
    salePrice= [[NSMutableArray alloc] init];
    specId= [[NSMutableArray alloc] init];
    specName = [[NSMutableArray alloc] init];
    specPrice = [[NSMutableArray alloc] init];
    shopCartIds= [[NSMutableArray alloc] init];
    isSelect= [[NSMutableArray alloc] init];
    xuanzhongshopCartIds= [[NSMutableArray alloc] init];
    quantitys= [[NSMutableArray alloc] init];
    self.sat=nil;
    

    pageNumber = 1;
    pageNumber1= 1;
    
    dealPrice= [[NSMutableArray alloc] init];
    headImage= [[NSMutableArray alloc] init];
    itemId= [[NSMutableArray alloc] init];
    itemName= [[NSMutableArray alloc] init];
    quantity= [[NSMutableArray alloc] init];
    salePrice= [[NSMutableArray alloc] init];
    specId= [[NSMutableArray alloc] init];
    specName = [[NSMutableArray alloc] init];
    specPrice = [[NSMutableArray alloc] init];
    shopCartIds= [[NSMutableArray alloc] init];
    isSelect= [[NSMutableArray alloc] init];
    xuanzhongshopCartIds= [[NSMutableArray alloc] init];
    quantitys= [[NSMutableArray alloc] init];
    meiyousuos=@"meiyou";
    sous=nil;
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    
    
    NSLog(@"====%@",param);
//    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    
    [HttpRequest requestData:@"Business/ShopCart/Detail" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            NSLog(@"====%@",severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
            
                UIView*view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 80/2)];
                view.backgroundColor=zuiqianhuicolor;
                _table.tableHeaderView=view;
                
                xuanze=[[UIButton alloc]initWithFrame:CGRectMake(10, 6, 30, 30)];
                [xuanze setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
                if ([[severDataDict.dataDict objectForKey:@"selStatus"]isEqualToString:@"all"]) {
                    [xuanze setImage:[UIImage imageNamed:@"gous"] forState:UIControlStateNormal];
                }else{
                
                [xuanze setImage:[UIImage imageNamed:@"quans"] forState:UIControlStateNormal];
                
                }
                
                [xuanze addTarget:self action:@selector(xuanze:) forControlEvents:UIControlEventTouchUpInside];
                [view addSubview:xuanze];
                
                UIButton*quanxuanze=[[UIButton alloc]initWithFrame:CGRectMake(xuanze.right+5, 6, 30, 30)];
                
                [quanxuanze setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
                [quanxuanze setTitle:@"全选" forState:UIControlStateNormal ];
                quanxuanze.titleLabel.font=[UIFont systemFontOfSize:15];
                [view addSubview:quanxuanze];

      
                
                UIButton*shaixuanBtn=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth*590/750,  15/2, ScreenWidth*140/750,50/2)];
                [shaixuanBtn.layer setCornerRadius:2.0];
                [shaixuanBtn.layer setBorderWidth:0.5];
                [shaixuanBtn.layer setMasksToBounds:YES];
                [shaixuanBtn addTarget:self action:@selector(empty:) forControlEvents:UIControlEventTouchUpInside];
                CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
                CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){153/255.0,153/255.0, 153/255.0, 1.0   });
                [shaixuanBtn.layer setBorderColor:colorref2];//边框颜色
//                [shaixuanBtn setTitle:@"     清空" forState:UIControlStateNormal];
                shaixuanBtn.titleLabel.font=[UIFont systemFontOfSize:contenfot];
                [shaixuanBtn setTitleColor:shenhuicolor forState:UIControlStateNormal];
                shaixuanBtn.titleLabel.textAlignment=NSTextAlignmentRight;
//                [view addSubview:shaixuanBtn];
                
                
                sxBtn = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth*670/750,20/2, 30/2, 30/2)];
                [sxBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
                [sxBtn addTarget:self action:@selector(empty:) forControlEvents:UIControlEventTouchUpInside];
                [view addSubview:sxBtn];

                NSMutableArray* arrr=[[NSMutableArray alloc]init];
                arrr=[severDataDict.dataDict objectForKey:@"DataLine"];
                for (NSDictionary* dicc in arrr )
                {
                    [dealPrice addObject:[dicc valueForKey:@"dealPrice"]];
                    [headImage addObject:[dicc valueForKey:@"headImageFull"]];
                    [itemId addObject:[dicc valueForKey:@"itemCode"]];
                    [itemName addObject:[dicc valueForKey:@"itemName"]];
                    [quantity addObject:[dicc valueForKey:@"quantity"]];
                    [salePrice addObject:[dicc valueForKey:@"salePrice"]];
                    [specId addObject:[dicc valueForKey:@"specId"]];
                    [shopCartIds addObject:[dicc valueForKey:@"id"]];
                    [specName addObject:[dicc valueForKey:@"specName"]];
                    [isSelect addObject:[dicc valueForKey:@"isSelect"]];
                if ([[dicc valueForKey:@"isSelect"]isEqualToString:@"Y"]) {
                        [xuanzhongshopCartIds addObject:[dicc valueForKey:@"id"]];
                        [quantitys addObject:[dicc valueForKey:@"quantity"]];
                    
                    }
                    [specPrice addObject:[dicc valueForKey:@"specPrice"]];

          
            }
  
                
                toumingtu=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-arrr.count*120-104)];
                toumingtu.backgroundColor=[UIColor clearColor];
                
                // 手势
                UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad)];
                singleFingerOne.numberOfTouchesRequired = 1; //手指数
                singleFingerOne.numberOfTapsRequired = 1; //tap次数
                singleFingerOne.delegate = self;
                _table.tableFooterView=toumingtu;
                [toumingtu addGestureRecognizer:singleFingerOne];
                [_table reloadData];
            
                
                [hejibuyBtn1 removeFromSuperview];
                [buyBtn2 removeFromSuperview];

                
                
                
                NSString*GoldPrice=[NSString stringWithFormat:@"%@",[severDataDict.dataDict objectForKey:@"totalMoney"]];
                NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
                [numberFormatter setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:GoldPrice.floatValue]];
                
                hejibuyBtn1=[[UIButton alloc]initWithFrame:CGRectMake(0, ScreenHeight-45, ScreenWidth*430/750, 45)];
                [hejibuyBtn1 setTitle:[NSString stringWithFormat:@"   合计 ¥ %@",formattedNumberString] forState:UIControlStateNormal];
                hejibuyBtn1.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0];
                [hejibuyBtn1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                hejibuyBtn1.alpha=0.8;
                hejibuyBtn1.contentHorizontalAlignment=UIControlContentHorizontalAlignmentFill;
                hejibuyBtn1.contentVerticalAlignment=UIControlContentVerticalAlignmentBottom;
                hejibuyBtn1.titleLabel.font=[UIFont systemFontOfSize:18];
                NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"   合计 ¥ %@",formattedNumberString]];
                
                [AttributedStr addAttribute:NSFontAttributeName
                 
                                      value:[UIFont systemFontOfSize:13]
                 
                                      range:NSMakeRange(0, 7)];
                
                [AttributedStr addAttribute:NSForegroundColorAttributeName
                 
                                      value:[UIColor whiteColor]
                 
                                      range:NSMakeRange(0, 7)];
                
                
                hejibuyBtn1.titleLabel.attributedText = AttributedStr;
                
                UIButton* shuliang=[[UIButton alloc]initWithFrame:CGRectMake(0, 8, ScreenWidth*430/750, 11)];
                NSNumber *sum = [quantitys valueForKeyPath:@"@sum.floatValue"];
                
                [shuliang setTitle:[NSString stringWithFormat:@"   已选商品 %@ 件",sum] forState:UIControlStateNormal];
                shuliang.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0];
                [shuliang setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                shuliang.titleLabel.font=[UIFont systemFontOfSize:11];
                 shuliang.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
                [hejibuyBtn1 addSubview:shuliang];
                
                
         
               
    if ([[severDataDict.dataDict objectForKey:@"DataLine"] count]==0) {
            
            [Global hideProgressHUDInternal:self.view];
            
            [_table reloadData];
            [hejibuyBtn1 removeFromSuperview];
            [buyBtn2 removeFromSuperview];
     
                [kong removeFromSuperview];
                [kong1 removeFromSuperview];
                
                kong=[[UIButton alloc]initWithFrame:CGRectMake(0, ScreenHeight/2-64, ScreenWidth, 30)];
                [kong setTitle:@"温馨提示，购物车为空！" forState:UIControlStateNormal];
                [kong addTarget:self action:@selector(go:) forControlEvents:UIControlEventTouchUpInside];
                kong.titleLabel.font=[UIFont systemFontOfSize:sixteenORfifteenFot];
                kong.titleLabel.textAlignment=NSTextAlignmentCenter;
                [kong setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
                [self.view addSubview:kong];
                
                kong1=[[UIButton alloc]initWithFrame:CGRectMake(0, ScreenHeight/2+30, 100, 45)];
                [kong1 setTitle:@"去购物" forState:UIControlStateNormal];
                [kong1 addTarget:self action:@selector(go:) forControlEvents:UIControlEventTouchUpInside];
                kong1.titleLabel.font=[UIFont systemFontOfSize:sixteenORfifteenFot];
                kong1.titleLabel.textAlignment=NSTextAlignmentCenter;
                kong1.backgroundColor=zuiqianhuicolor;
                kong1.center=self.view.center;
                [kong1 setTitleColor:shenhuicolor forState:UIControlStateNormal];
                [self.view addSubview:kong1];
         

        
        }else{
            [kong removeFromSuperview];
             [kong1 removeFromSuperview];
            [self.view addSubview:hejibuyBtn1];
            
            buyBtn2=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth*430/750, ScreenHeight-45, ScreenWidth*320/750, 45)];
            [buyBtn2 setTitle:@"确认订单" forState:UIControlStateNormal];
            buyBtn2.backgroundColor=luseColor;
            [buyBtn2 addTarget:self action:@selector(queren:) forControlEvents:UIControlEventTouchUpInside];
            
            [buyBtn2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            [self.view addSubview:buyBtn2];

        
        }
            
           
            
            
            }else{
                
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {

                 TheLoginViewController *detailViewController = [[TheLoginViewController alloc] init];
                 [self.navigationController pushViewController:detailViewController animated:YES];
             }
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    myToolBar=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, viewheight)];
    myToolBar.backgroundColor=jianpancolor;
    UIButton*  tubtnDone=[[UIButton alloc]initWithFrame:CGRectMake(logoX,logoY, logoheight, logowidth)];
    [tubtnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [tubtnDone addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:tubtnDone];
    UIButton*btnDone111=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width - 55, 12, 40, 16)];
    [btnDone111 setTitle:@"确定" forState:UIControlStateNormal];
    [btnDone111 setTitleColor:jianpancolor1 forState:UIControlStateNormal];
    btnDone111 .titleLabel .font=[UIFont systemFontOfSize:daxiao];
    [btnDone111 addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:btnDone111];
    myToolBar.alpha=alp;
    UIButton* dabtn=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width-60, 0, 60, 40)];
    [dabtn addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:dabtn];
    
   

    
    
   
}


-(void)go:(UIButton*)sender
{
    commdity.how=@"Detail";
     GetProductListViewController*detailViewController = [[GetProductListViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:YES];

}

-(void)queren:(UIButton*)sender
{
    if (xuanzhongshopCartIds.count>0) {
        
        commdity.userName=nil;
        shouyingViewController *detailViewController = [[shouyingViewController alloc] init];
        
      
        [self.navigationController pushViewController:detailViewController animated:YES];
    }else{
    
    
        [self showAlertMessage:@"请选择购买的商品！"];
    
    
    }

}


//全选还是不全选
-(void)xuanze:(UIButton*)sender
{
    
//    specId=sender.titleLabel.text;
    saveAccount=!saveAccount;
    if (saveAccount) {
        
        [sender setImage:[UIImage imageNamed:@"gous"] forState:UIControlStateNormal];
        
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        if (Token ==nil) {
            Token=@"dd";
        }
        NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
        [param setValue:@"Y" forKey:@"isSelect"];
        
        
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
        
        
        [HttpRequest requestData:@"Business/ShopCart/SelAll" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {   NSLog(@"-----------%@", severDataDict.dataDict);
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];

                    
                    [self add];
                    
                    
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];

        
        
        
    }
    else
    {
        
        [sender setImage:[UIImage imageNamed:@"quans"] forState:UIControlStateNormal];
        
        
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        if (Token ==nil) {
            Token=@"dd";
        }
        NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
        [param setValue:@"N" forKey:@"isSelect"];

        
        
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
        
        
        [HttpRequest requestData:@"Business/ShopCart/SelAll" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {   NSLog(@"-----------%@", severDataDict.dataDict);
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];

                    
                    [self add];
                    
                    
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];

        
        
        
        
    }
    
    
    
    
}



//上拉刷新
- (void)addFooter
{
    

    
    MJRefreshFooterView* footer = [MJRefreshFooterView footer];
    footer.scrollView = _table;
    footer.beginRefreshingBlock = ^(MJRefreshBaseView* refreshView)
    {
        
        
        
        [self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:2.0f];
        NSLog(@"%@--->正在刷新", refreshView.class);
    };
    
}
- (void)doneWithView:(MJRefreshBaseView *)refreshView
{
    [_table reloadData];
    [refreshView endRefreshing];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [itemId count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    shopcatCell* cell = (shopcatCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"shopcatCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    UIButton*jiantou = [[UIButton alloc]init];
    jiantou.frame = CGRectMake(0,0, 8, 13);
    [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    
    //    cell.accessoryView = jiantou;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
        [cell.imageview.layer setCornerRadius:4.0];
        [cell.imageview.layer setBorderWidth:0.3];
        [cell.imageview.layer setMasksToBounds:YES];
        CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
        CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){ 0, 0, 0, 0.3 });
        [cell.imageview.layer setBorderColor:colorref2];//边框颜色
        [cell.imageview setImageWithURL:[NSURL URLWithString:[headImage objectAtIndex:indexPath.row]] placeholderImage:[UIImage imageNamed:@""]];
    

    
    cell.shopCartId=[shopCartIds objectAtIndex:indexPath.row];
    
    cell.title.text =[NSString stringWithFormat:@"%@ %@",  [itemId objectAtIndex:indexPath.row],[itemName objectAtIndex:indexPath.row]];
    cell.title.font=[UIFont systemFontOfSize:16];
    cell.title.textColor=[UIColor blackColor];

    cell.title.numberOfLines=2;
    if ([[specName objectAtIndex:indexPath.row]isEqualToString:@""]) {
        cell.guige.text =[NSString stringWithFormat:@"%@",@" "];
    }else{
        cell.guige.text =[NSString stringWithFormat:@"%@",[specName objectAtIndex:indexPath.row]];}
    cell.guige.font=[UIFont systemFontOfSize:15];
    cell.guige.textColor=zhonghuiColor;

    cell.shuliang.text =[NSString stringWithFormat:@"%.f",  [[quantity objectAtIndex:indexPath.row]floatValue]];
    cell.shuliang.font=[UIFont systemFontOfSize:15];
  
    NSString*GoldPrice=[NSString stringWithFormat:@"%@",[dealPrice objectAtIndex:indexPath.row]];
    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
    [numberFormatter setPositiveFormat:@"###,##0.00;"];
    NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:GoldPrice.floatValue]];
    cell.jiage.text =[NSString stringWithFormat:@"￥%@",  formattedNumberString];
    cell.jiage.font=[UIFont systemFontOfSize:eighteenthORfifteenFot];
    cell.jiage.textColor=hongsecolor;
   cell.xiugaijiage=[NSString stringWithFormat:@"%@",[dealPrice objectAtIndex:indexPath.row]];
   cell.isSelect=[NSString stringWithFormat:@"%@",[isSelect objectAtIndex:indexPath.row]];
    
    if ([[isSelect objectAtIndex:indexPath.row]isEqualToString:@"Y"]) {
        [cell.xuanzeBtn setImage:[UIImage imageNamed:@"gous"] forState:UIControlStateNormal];
    }else{
    
    [cell.xuanzeBtn setImage:[UIImage imageNamed:@"quans"] forState:UIControlStateNormal];
    
    }
    [cell.xuanzeBtn addTarget:self action:@selector(xuanzeBtn:) forControlEvents:UIControlEventTouchUpInside];
    [cell.xiugai setBackgroundImage :[UIImage imageNamed:@"bianji.png"] forState:UIControlStateNormal];
    [cell.xiugai addTarget:self action:@selector(xiugai:) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    if (itemId.count !=indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 120-0.35, ScreenWidth-30, 0.35)];
        lineLabel1.backgroundColor=zuiqianhuicolor;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    if (itemId.count ==indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, 120-0.35, ScreenWidth, 0.35)];
        lineLabel1.backgroundColor=zuiqianhuicolor;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    return cell;
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return  120;
}

#pragma mark - Table view delegate

//选择按钮

-(void)xuanzeBtn:(UIButton*)sender{
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
UIButton* button=(UIButton * )sender;
shopcatCell* cell=(shopcatCell* )button.superview.superview;
shopCartId=cell.shopCartId;
    if ([cell.isSelect isEqualToString:@"N"]) {
        
     
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
        
        [param setValue:cell.shopCartId forKey:@"shopCartId"];
        [param setValue:cell.xiugaijiage forKey:@"dealPrice"];
        [param setValue:cell.shuliang.text forKey:@"quantity"];
        [param setValue:@"Y" forKey:@"isSelect"];
        NSLog(@"-----------%@", param);
        [HttpRequest requestData:@"Business/ShopCart/Modify" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
               
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];
                    
                    [self add];
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];

    
    }
    else
    {

       
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
        
        [param setValue:cell.shopCartId forKey:@"shopCartId"];
        [param setValue:cell.xiugaijiage forKey:@"dealPrice"];
        [param setValue:cell.shuliang.text forKey:@"quantity"];
        [param setValue:@"N" forKey:@"isSelect"];
         NSLog(@"-----------%@", param);
        [HttpRequest requestData:@"Business/ShopCart/Modify" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
            
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];

                    [self add];
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];
 
       
    }


}





//修改按钮
-(void)xiugai:(UIButton*)sender{
     [xiugaiview removeFromSuperview];
     UIButton* button=(UIButton * )sender;
    shopcatCell* cell=(shopcatCell* )button.superview.superview;
    
    shopCartId=cell.shopCartId;
    
    
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
        
        [param setValue:cell.shopCartId forKey:@"shopCartId"];
        [param setValue:cell.xiugaijiage forKey:@"dealPrice"];
        [param setValue:cell.shuliang.text forKey:@"quantity"];
        [param setValue:@"Y" forKey:@"isSelect"];
        NSLog(@"-----------%@", param);
        [HttpRequest requestData:@"Business/ShopCart/Modify" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
                NSLog(@"-----------%@", severDataDict.dataDict);
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];
               

                    
                    xiugaiview=[[UIButton alloc]initWithFrame:CGRectMake(cell.imageview.right+10, 0, ScreenWidth, 120)];
                    xiugaiview.backgroundColor=zuiqianhuicolor;
                    [cell addSubview:xiugaiview];
                    
                    UILabel* label=[[UILabel alloc]initWithFrame:CGRectMake(15, 30, 50, 16)];
                    label.text=@"成交价";
                    label.textColor=shenhuicolor;
                    label.font=[UIFont systemFontOfSize:16];
                    [xiugaiview addSubview:label];
                    
                    
                    jiageTextFied=[[UITextField alloc]initWithFrame:CGRectMake(label.right+10,  30, 150, 18)];
                    
                     jiageTextFied.keyboardType = UIKeyboardTypeDecimalPad;
                    jiageTextFied.borderStyle = UITextBorderStyleNone;
                    jiageTextFied.font = [UIFont systemFontOfSize: contenfot];
                    jiageTextFied.textColor=[UIColor blackColor];
                    jiageTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
                    jiageTextFied.tag=1;
                    jiageTextFied.text=cell.xiugaijiage;
                    [jiageTextFied setUserInteractionEnabled:YES];
                    jiageTextFied.font=[UIFont systemFontOfSize:18];
                    jiageTextFied.delegate = self;
                    jiageTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
                    [xiugaiview addSubview:jiageTextFied];
                     jiageTextFied.inputAccessoryView = myToolBar;
                    UILabel* shulianglabel=[[UILabel alloc]initWithFrame:CGRectMake(15, 75, 50, 16)];
                    shulianglabel.text=@"数量";
                    shulianglabel.textColor=shenhuicolor;
                    shulianglabel.font=[UIFont systemFontOfSize:15];
                    [xiugaiview addSubview:shulianglabel];
                    
                    
                    UIImageView*shuimageview=[[UIImageView alloc]initWithFrame:CGRectMake(shulianglabel.right+10, 70, 110, 30)];
                    shuimageview .image=[UIImage imageNamed:@"tianjias"];
                    [xiugaiview addSubview:shuimageview];
                    
                    shu=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 110, 30)];
                    shu.text=[NSString stringWithFormat:@"%@",  cell.shuliang.text];
                    shu.textColor=[UIColor blackColor];
                    shu.center=shuimageview.center;
                    shu.textAlignment=NSTextAlignmentCenter;
                    shu.font=[UIFont systemFontOfSize:15];
                    [xiugaiview addSubview:shu];
                    
                    UIButton*jian=[[UIButton alloc]initWithFrame:CGRectMake(shulianglabel.right+10, 70, 30, 30)];
                    [jian addTarget:self action:@selector(jian:) forControlEvents:UIControlEventTouchUpInside];
                    [xiugaiview addSubview:jian];
                    
                    UIButton*jia=[[UIButton alloc]initWithFrame:CGRectMake(shulianglabel.right+15+90,70, 30, 30)];
                    [jia addTarget:self action:@selector(jia:) forControlEvents:UIControlEventTouchUpInside];
                    [xiugaiview addSubview:jia];
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];

}

//加


-(void)jia:(UIButton*)sender
{
    
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    int d;
    d=shu.text.intValue;
    d++;
    shu.text=[NSString stringWithFormat:@"%d",  d];
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    
    [param setValue:shopCartId forKey:@"shopCartId"];
    [param setValue:[NSString stringWithFormat:@"%.2f",  jiageTextFied.text.doubleValue] forKey:@"dealPrice"];
    [param setValue:shu.text forKey:@"quantity"];
    [param setValue:@"Y" forKey:@"isSelect"];
    NSLog(@"-----------%@", param);
    [HttpRequest requestData:@"Business/ShopCart/Modify" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
             NSLog(@"-----------%@", severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                [self add];
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];

    
    
}
//减
-(void)jian:(UIButton*)sender
{
       [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    int d;
    d=shu.text.intValue;
    
    if (d>=1) {
        d--;
        shu.text=[NSString stringWithFormat:@"%d",  d];
        
    }

    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:shopCartId forKey:@"shopCartId"];
    [param setValue:[NSString stringWithFormat:@"%.2f",  jiageTextFied.text.doubleValue] forKey:@"dealPrice"];
    [param setValue:shu.text forKey:@"quantity"];
    [param setValue:@"Y" forKey:@"isSelect"];
    NSLog(@"-----------%@", param);
    [HttpRequest requestData:@"Business/ShopCart/Modify" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                
                [Global hideProgressHUDInternal:self.view];
                
                [self add];
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];


    
}

-(void)closeKeyBoad
{
    
    [xiugaiview removeFromSuperview];
}



//删除
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        
        
        [xiugaiview removeFromSuperview];
    
    
    
}
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
    return  UITableViewCellEditingStyleDelete;
    
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}


-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath

{
    
    return @"删除";
    
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:@[shopCartIds[indexPath.row]] forKey:@"shopCartIds"];
    
    
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    
    [HttpRequest requestData:@"Business/ShopCart/Remove" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {   NSLog(@"-----------%@", severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
         
                [Global showTextHudSub:requestResultStr view:self.view];
            
                 [self add];
           
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
}



//清空购物车
-(void)empty:(UIButton*)sender{
    
    
    UIAlertView*alt1 = [[UIAlertView alloc] initWithTitle:@"是否清空购物车！" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
    [alt1 show];
    
    
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    
    if (buttonIndex == 1) {

        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        if (Token ==nil) {
            Token=@"dd";
        }
        NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
        [param setValue:xuanzhongshopCartIds forKey:@"shopCartIds"];
        
        NSLog(@"-----------%@", param);
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
        
        
        [HttpRequest requestData:@"Business/ShopCart/Remove" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {   NSLog(@"-----------%@", severDataDict.dataDict);
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];

                    
                    [self add];
                    
                    
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];

    
    
    
    }
    if (buttonIndex == 0) {
 
        
    }
    
    
}





- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}

////上拉刷新
//- (void)addheader
//{
//    MJRefreshHeaderView* footer = [MJRefreshHeaderView header];
//    footer.scrollView = _table;
//    footer.beginRefreshingBlock = ^(MJRefreshBaseView* refreshView)
//    {
//
//        //        [Global hideProgressHUDInternal:mainScroll];
//
//
//        //这里的RefreshView就是footer
//        [self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:3.0f];
//        //        NSLog(@"%@--->正在刷新", mainScroll.class);
//    };
//
//}

-(void)jiazai1{
    [jiazai removeFromSuperview];
    
    
}
-(void)OnTapDone{
    
    [jiageTextFied resignFirstResponder];
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:shopCartId forKey:@"shopCartId"];
    [param setValue:[NSString stringWithFormat:@"%.2f",  jiageTextFied.text.doubleValue] forKey:@"dealPrice"];
    [param setValue:shu.text forKey:@"quantity"];
    [param setValue:@"Y" forKey:@"isSelect"];
    NSLog(@"-----------%@", param);
    [HttpRequest requestData:@"Business/ShopCart/Modify" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                
                [Global hideProgressHUDInternal:self.view];
                
                [self add];
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];

    
}
@end
